From: Andrew Cooper Date: Fri, 6 Jan 2017 14:08:09 +0000 (+0100) Subject: x86: fix build with older versions of GCC following e34bc403c3 X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~3043 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=9422b16a507120354a4d58d0abc20be3018d4a0e;p=xen.git x86: fix build with older versions of GCC following e34bc403c3 GCCs of at least 4.4 and earlier do not tollerate the initialisiation of the $VENDOR_cpu_dev structures, because of c_ident becoming an anonymous union. Instead of using an anonymous union, reintepret c_ident[] in its CPUID form just in get_cpu_vendor(). Signed-off-by: Andrew Cooper Tested-by: Boris Ostrovsky Reviewed-by: Jan Beulich --- diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c index d17a2ee05b..7d6d0249e5 100644 --- a/xen/arch/x86/cpu/common.c +++ b/xen/arch/x86/cpu/common.c @@ -163,8 +163,11 @@ int get_cpu_vendor(uint32_t b, uint32_t c, uint32_t d, enum get_cpu_vendor mode) for (i = 0; i < X86_VENDOR_NUM; i++) { if (cpu_devs[i]) { - if (cpu_devs[i]->b == b && cpu_devs[i]->c == c && - cpu_devs[i]->d == d) { + struct { + uint32_t b, d, c; + } *ptr = (void *)cpu_devs[i]->c_ident; + + if (ptr->b == b && ptr->c == c && ptr->d == d) { if (mode == gcv_host) this_cpu = cpu_devs[i]; return i; diff --git a/xen/arch/x86/cpu/cpu.h b/xen/arch/x86/cpu/cpu.h index 5a7905c31a..3eeebe3740 100644 --- a/xen/arch/x86/cpu/cpu.h +++ b/xen/arch/x86/cpu/cpu.h @@ -1,13 +1,7 @@ /* attempt to consolidate cpu attributes */ struct cpu_dev { char c_vendor[8]; - - union { - char c_ident[13]; - struct { - uint32_t b, d, c; - }; - }; + char c_ident[13]; void (*c_early_init)(struct cpuinfo_x86 *c); void (*c_init)(struct cpuinfo_x86 * c);